home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / obero / oberon_lib.lha / oberon-a / source1.lha / source / Amiga / CardRes.mod < prev    next >
Text File  |  1994-08-08  |  7KB  |  295 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: CardRes.mod $
  4.   Description: Interface to card.resource
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.1 $
  8.       $Author: fjc $
  9.         $Date: 1994/08/08 01:15:52 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1990-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A Interface Copyright © 1994, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. *************************************************************************)
  21.  
  22. MODULE CardRes;
  23.  
  24. (*
  25. ** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
  26. ** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
  27. ** $V- OvflChk       $Z- ZeroVars
  28. *)
  29.  
  30. IMPORT E := Exec, SYS := SYSTEM;
  31.  
  32. (*
  33. **      $VER: card.h 1.11 (14.12.92)
  34. **
  35. **      card.resource include file
  36. *)
  37.  
  38. CONST
  39.  
  40.   name * = "card.resource";
  41.  
  42. TYPE
  43.  
  44. (* Structures used by the card.resource                         *)
  45.  
  46.   CardHandlePtr * = CPOINTER TO CardHandle;
  47.   CardHandle  * = RECORD (E.Node)
  48.     removed *  : E.InterruptPtr;
  49.     inserted * : E.InterruptPtr;
  50.     status *   : E.InterruptPtr;
  51.     flags *    : E.BSET;
  52.   END;
  53.  
  54.   DeviceTDataPtr * = CPOINTER TO DeviceTData;
  55.   DeviceTData  * = RECORD
  56.     size *  : E.ULONG;       (* Size in bytes                *)
  57.     speed * : E.ULONG;       (* Speed in nanoseconds         *)
  58.     type *  : E.UBYTE;       (* Type of card                 *)
  59.     flags * : E.BSET;        (* Other flags                  *)
  60.   END;
  61.  
  62.   CardMemoryMapPtr * = CPOINTER TO CardMemoryMap;
  63.   CardMemoryMap  * = RECORD
  64.     commonMemory *    : E.APTR;
  65.     attributeMemory * : E.APTR;
  66.     ioMemory *        : E.APTR;
  67.  
  68. (* Extended for V39 - These are the size of the memory spaces above *)
  69.  
  70.     commonMemSize *    : E.ULONG;
  71.     attributeMemSize * : E.ULONG;
  72.     ioMemSize *        : E.ULONG;
  73.  
  74.   END;
  75.  
  76. CONST
  77.  
  78. (* CardHandle.cah_CardFlags for OwnCard() function              *)
  79.  
  80.   resetRemove * = 0;
  81.  
  82.   ifAvailable * = 1;
  83.  
  84.   delayOwnership * = 2;
  85.  
  86.   postStatus * = 3;
  87.  
  88. (* ReleaseCreditCard() function flags                           *)
  89.  
  90.   removeHandle * = 0;
  91.  
  92. (* ReadStatus() return flags                                    *)
  93.  
  94.   statusCCDET * = 6;
  95.  
  96.   statusBVD1 * = 5;
  97.  
  98.   statusSC * = 5;
  99.  
  100.   statusBVD2 * = 4;
  101.  
  102.   statusDA * = 4;
  103.  
  104.   statusWR * = 3;
  105.  
  106.   statusBSY * = 2;
  107.  
  108.   statusIRQ * = 2;
  109.  
  110. (* CardProgramVoltage() defines *)
  111.  
  112.   voltage0V * = 0;                 (* Set to default; may be the same as 5V *)
  113.   voltage5V * = 1;
  114.   voltage12V * = 2;
  115.  
  116. (* CardMiscControl() defines *)
  117.  
  118.   enableDigAudio * = 1;
  119.  
  120.   disableWP * = 3;
  121.  
  122. (*
  123.  * New CardMiscControl() bits for V39 card.resource.  Use these bits to set,
  124.  * or clear status change interrupts for BVD1/SC, BVD2/DA, and BSY/IRQ.
  125.  * Write-enable/protect change interrupts are always enabled.  The defaults
  126.  * are unchanged (BVD1/SC is enabled, BVD2/DA is disabled, and BSY/IRQ is enabled).
  127.  *
  128.  * IMPORTANT -- Only set these bits for V39 card.resource or greater (check
  129.  * resource base VERSION)
  130.  *
  131.  *)
  132.  
  133.   intSetClr * = 7;
  134.  
  135.   intBVD1 * = 5;
  136.  
  137.   intSC * = 5;
  138.  
  139.   intBVD2 * = 4;
  140.  
  141.   intDA * = 4;
  142.  
  143.   intBSY * = 2;
  144.  
  145.   intIRQ * = 2;
  146.  
  147.  
  148. (* CardInterface() defines *)
  149.  
  150.   interfaceAmiga0 * = 0;
  151.  
  152. (*
  153.  * Tuple for Amiga execute-in-place software (e.g., games, or other
  154.  * such software which wants to use execute-in-place software stored
  155.  * on a credit-card, such as a ROM card).
  156.  *
  157.  * See documentatin for IfAmigaXIP().
  158.  *)
  159.  
  160.   cistplAmigaXip * = 091H;
  161.  
  162. TYPE
  163.  
  164.   TPAmigaXIPPtr * = CPOINTER TO TPAmigaXIP;
  165.   TPAmigaXIP  * = RECORD
  166.     code *  : E.UBYTE;
  167.     link *  : E.UBYTE;
  168.     loc *   : ARRAY 4 OF E.UBYTE;
  169.     flags * : E.BSET;
  170.     resrv * : E.UBYTE;
  171.   END;
  172.  
  173. CONST
  174.  
  175. (*
  176.  
  177.         ; The XIPFLAGB_AUTORUN bit means that you want the machine
  178.         ; to perform a reset if the execute-in-place card is inserted
  179.         ; after DOS has been started.  The machine will then reset,
  180.         ; and execute your execute-in-place code the next time around.
  181.         ;
  182.         ; NOTE -- this flag may be ignored on some machines, in which
  183.         ; case the user will have to manually reset the machine in the
  184.         ; usual way.
  185.  
  186. *)
  187.  
  188.   xipFlagsAutoRun * = 0;
  189.  
  190. (**-- Library Base variable --------------------------------------------*)
  191.  
  192. TYPE
  193.  
  194.   CardResBasePtr* = CPOINTER TO CardResBase;
  195.   CardResBase* = RECORD END;
  196.  
  197. VAR
  198.  
  199.   base* : CardResBasePtr;
  200.  
  201.  
  202. (**-- Library Functions ------------------------------------------------*)
  203.  
  204. (*
  205. **      $VER: cardres_protos.h 1.2 (8.9.92)
  206. *)
  207.  
  208. LIBCALL (base : CardResBasePtr) OwnCard *
  209.   ( handle [9] : CardHandlePtr )
  210.   : CardHandlePtr;
  211.   -6;
  212. LIBCALL (base : CardResBasePtr) ReleaseCard *
  213.   ( handle [9] : CardHandlePtr;
  214.     flags  [0] : E.ULONG );
  215.   -12;
  216. LIBCALL (base : CardResBasePtr) GetCardMap * ()
  217.   : CardMemoryMapPtr;
  218.   -18;
  219. LIBCALL (base : CardResBasePtr) BeginCardAccess *
  220.   ( handle [9] : CardHandlePtr )
  221.   : BOOLEAN;
  222.   -24;
  223. LIBCALL (base : CardResBasePtr) EndCardAccess *
  224.   ( handle [9] : CardHandlePtr )
  225.   : BOOLEAN;
  226.   -30;
  227. LIBCALL (base : CardResBasePtr) ReadCardStatus * ()
  228.   : E.UBYTE;
  229.   -36;
  230. LIBCALL (base : CardResBasePtr) CardResetRemove *
  231.   ( handle [9] : CardHandlePtr;
  232.     flag   [0] : E.ULONG )
  233.   : BOOLEAN;
  234.   -42;
  235. LIBCALL (base : CardResBasePtr) CardMiscControl *
  236.   ( handle      [9] : CardHandlePtr;
  237.     controlBits [1] : E.BSET )
  238.   : E.BSET;
  239.   -48;
  240. LIBCALL (base : CardResBasePtr) CardAccessSpeed *
  241.   ( handle      [9] : CardHandlePtr;
  242.     nanoseconds [0] : E.ULONG )
  243.   : E.ULONG;
  244.   -54;
  245. LIBCALL (base : CardResBasePtr) CardProgramVoltage *
  246.   ( handle  [9] : CardHandlePtr;
  247.     voltage [0] : E.ULONG )
  248.   : LONGINT;
  249.   -60;
  250. LIBCALL (base : CardResBasePtr) CardResetCard *
  251.   ( handle [9] : CardHandlePtr )
  252.   : BOOLEAN;
  253.   -66;
  254. LIBCALL (base : CardResBasePtr) CopyTuple *
  255.   ( handle    [9] : CardHandlePtr;
  256.     buffer    [8] : ARRAY OF SYS.BYTE;
  257.     tuplecode [1] : E.ULONG;
  258.     size      [0] : E.ULONG )
  259.   : BOOLEAN;
  260.   -72;
  261. LIBCALL (base : CardResBasePtr) DeviceTuple *
  262.   ( tupleData [8] : E.APTR;
  263.     storage   [9] : DeviceTDataPtr )
  264.   : E.ULONG;
  265.   -78;
  266. LIBCALL (base : CardResBasePtr) IfAmigaXIP *
  267.   ( handle [10] : CardHandlePtr )
  268.   : E.ResidentPtr;
  269.   -84;
  270. LIBCALL (base : CardResBasePtr) CardForceChange * ()
  271.   : BOOLEAN;
  272.   -90;
  273. LIBCALL (base : CardResBasePtr) CardChangeCount * ()
  274.   : E.ULONG;
  275.   -96;
  276. LIBCALL (base : CardResBasePtr) CardInterface * ()
  277.   : E.ULONG;
  278.   -102;
  279.  
  280. (**-- Library Base variable --------------------------------------------*)
  281.  
  282. (**-----------------------------------*)
  283. PROCEDURE OpenResource * (mustOpen : BOOLEAN);
  284.  
  285. BEGIN (* OpenResource *)
  286.   IF base = NIL THEN
  287.     base := SYS.VAL (CardResBasePtr, E.base.OpenResource (name));
  288.     IF mustOpen & (base = NIL) THEN HALT (100) END
  289.   END
  290. END OpenResource;
  291.  
  292. BEGIN
  293.   base := NIL
  294. END CardRes.
  295.